def fun(n):
    if n < 1:
        print("输入有误")
        return -1
    if n == 1 or n == 2:
        return 1
    elif n == 3:
        return  2
    else:
        return fun(n-1)+fun(n-2)+fun(n-3)

n = int(input("运算到第几项？"))
m = fun(n)
if n != -1:
    print("第{}项是{}".format(n,m))